# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: helpers\cleanup\__init__.py
__author__ = "Attila Gerendi (Sanyi)"
import time


class PeriodicCleanupWorker:
    def __init__(self):
        self.processes = list()
        self.should_stop = False

    def stop(self):
        self.should_stop = True
        for process in self.processes:
            process.stop()

    def add(self, process):
        self.processes.append(process)

    def run(self):
        while self.should_stop is False:
            for process in self.processes:
                process.run_once()

            for _ in range(0, 100):
                if self.should_stop:
                    break
                time.sleep(0.5)
